package abs.service;

import abs.domain.Clientes;
import abs.domain.Companias;
import abs.domain.GrupoClientes;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/absWeb-security-context.xml",
		"file:./resources/absWeb-service-context.xml",
		"file:./resources/absWeb-dao-context.xml",
		"file:./resources/absWeb-web-context.xml" })
@Transactional
public class GrupoClientesServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected GrupoClientesService service;

	/**
	 * Instantiates a new GrupoClientesServiceTest.
	 *
	 */
	public GrupoClientesServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Save an existing Companias entity
	 * 
	 */
	@Test
	public void saveGrupoClientesCompanias() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoClientesCompanias 
		String grpcl100cdgo = null;
		Companias related_companias = new abs.domain.Companias();
		GrupoClientes response = null;
		response = service.saveGrupoClientesCompanias(grpcl100cdgo, related_companias);
		// TODO: JUnit - Add assertions to test outputs of operation: saveGrupoClientesCompanias
	}

	/**
	 * Operation Unit Test
	 * Return all GrupoClientes entity
	 * 
	 */
	@Test
	public void findAllGrupoClientess() {
		// TODO: JUnit - Populate test inputs for operation: findAllGrupoClientess 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<GrupoClientes> response = null;
		response = service.findAllGrupoClientess(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllGrupoClientess
	}

	/**
	 * Operation Unit Test
	 * Delete an existing GrupoClientes entity
	 * 
	 */
	@Test
	public void deleteGrupoClientes() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoClientes 
		GrupoClientes grupoclientes = new abs.domain.GrupoClientes();
		service.deleteGrupoClientes(grupoclientes);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Companias entity
	 * 
	 */
	@Test
	public void deleteGrupoClientesCompanias() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoClientesCompanias 
		String grupoclientes_grpcl100cdgo = null;
		String related_companias_co000nocia = null;
		GrupoClientes response = null;
		response = service.deleteGrupoClientesCompanias(grupoclientes_grpcl100cdgo, related_companias_co000nocia);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteGrupoClientesCompanias
	}

	/**
	 * Operation Unit Test
	 * Save an existing Clientes entity
	 * 
	 */
	@Test
	public void saveGrupoClientesClienteses() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoClientesClienteses 
		String grpcl100cdgo_1 = null;
		Clientes related_clienteses = new abs.domain.Clientes();
		GrupoClientes response = null;
		response = service.saveGrupoClientesClienteses(grpcl100cdgo_1, related_clienteses);
		// TODO: JUnit - Add assertions to test outputs of operation: saveGrupoClientesClienteses
	}

	/**
	 * Operation Unit Test
	 * Load an existing GrupoClientes entity
	 * 
	 */
	@Test
	public void loadGrupoClientess() {
		Set<GrupoClientes> response = null;
		response = service.loadGrupoClientess();
		// TODO: JUnit - Add assertions to test outputs of operation: loadGrupoClientess
	}

	/**
	 * Operation Unit Test
	 * Save an existing GrupoClientes entity
	 * 
	 */
	@Test
	public void saveGrupoClientes() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoClientes 
		GrupoClientes grupoclientes_1 = new abs.domain.GrupoClientes();
		service.saveGrupoClientes(grupoclientes_1);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Clientes entity
	 * 
	 */
	@Test
	public void deleteGrupoClientesClienteses() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoClientesClienteses 
		String grupoclientes_grpcl100cdgo_1 = null;
		Integer related_clienteses_cl100cocl = 0;
		GrupoClientes response = null;
		response = service.deleteGrupoClientesClienteses(grupoclientes_grpcl100cdgo_1, related_clienteses_cl100cocl);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteGrupoClientesClienteses
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findGrupoClientesByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findGrupoClientesByPrimaryKey 
		String grpcl100cdgo_2 = null;
		GrupoClientes response = null;
		response = service.findGrupoClientesByPrimaryKey(grpcl100cdgo_2);
		// TODO: JUnit - Add assertions to test outputs of operation: findGrupoClientesByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Return a count of all GrupoClientes entity
	 * 
	 */
	@Test
	public void countGrupoClientess() {
		Integer response = null;
		response = service.countGrupoClientess();
		// TODO: JUnit - Add assertions to test outputs of operation: countGrupoClientess
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
